<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <title>购物车</title>
    <script th:src="@{/js/jquery-1.12.4.min.js}"></script>
    <script th:src="@{/js/jquery-ui.min.js}"></script>
    <script th:src="@{/js/index.js}"></script>
    <script th:src="@{/js/slide.js}"></script>
    <style>
        * {
            box-sizing: border-box;
        }

        body {
            font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
            background: #f5f5f5;
            color: #333;
            margin: 0;
        }

        .header_con, .search_bar, .footer {
            background-color: #fff;
            padding: 12px 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
        }

        .header .login_btn a,
        .header .user_link a {
            margin: 0 8px;
            color: #4D605F;
            text-decoration: none;
        }

        .header .login_btn a em {
            font-style: normal;
            color: #ff3e3e;
        }

        .search_bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
        }

        .logo img {
            height: 50px;
        }

        .sub_page_name {
            font-size: 18px;
            font-weight: bold;
            color: #666;
        }

        .search_con input.input_text {
            padding: 8px 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            width: 220px;
        }

        .search_con input.input_btn {
            background-color: #ff3e3e;
            color: white;
            padding: 8px 18px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .box {
            max-width: 1100px;
            margin: 40px auto;
            padding: 30px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        }

        .fl-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }

        .fl-table thead th {
            background-color: #4D605F;
            color: #fff;
            padding: 14px 12px;
            text-align: left;
        }

        .fl-table td {
            padding: 12px;
            border-bottom: 1px solid #eee;
        }

        .fl-table tr:nth-child(even) {
            background-color: #f9f9f9;
        }

        .fl-table input[type="number"],
        .fl-table input[type="text"] {
            padding: 4px;
            border: 1px solid #ddd;
            border-radius: 4px;
            text-align: center;
            width: 60px;
        }

        .fl-table a {
            color: #ff3e3e;
            text-decoration: none;
        }

        .tr3 td {
            padding-top: 24px;
            font-size: 16px;
            font-weight: bold;
        }

        .footer {
            margin-top: 60px;
            text-align: center;
            font-size: 14px;
            color: #aaa;
        }

        .footer .foot_link a {
            margin: 0 10px;
            color: #4D605F;
            text-decoration: none;
        }

        .btn-submit {
            margin-top: 24px;
            background-color: #ff3e3e;
            color: #fff;
            border: none;
            padding: 12px 30px;
            font-size: 16px;
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.3s ease;
        }

        .btn-submit:hover {
            background-color: #e63737;
        }
    </style>
</head>
<body>
<div class="header_con">
    <div class="header">
        <div>
            <div class="login_btn" th:if="${session.uaccount} ne null">
                <a href="">欢迎您：<em th:text="${session.uaccount}"></em></a>
                <span>|</span>
                <a href="http://localhost:8896/goods/quit">退出</a>
            </div>
            <div class="login_btn" th:if="${session.uaccount} eq null">
                <a href="http://localhost:8893/admin/tologin">请您登陆</a>
            </div>
        </div>
        <div class="user_link">
            <a href="/goods/cartAll">我的购物车</a>
            <span>|</span>
            <a href="/goods/getAllorder">我的订单</a>
        </div>
    </div>
</div>

<div class="search_bar">
    <a th:href="@{'getAll?uaccount='+${session.uaccount}}" class="logo"></a>
    <div class="sub_page_name">|&nbsp;&nbsp;&nbsp;&nbsp;购物车</div>
    <div class="search_con">
        <input type="text" class="input_text" placeholder="搜索商品">
        <input type="button" class="input_btn" value="搜索">
    </div>
</div>

<div class="box">
    <form method="get" action="/goods/paygoods">
        <table class="fl-table">
            <thead>
            <tr>
                <th>序号</th>
                <th>商品名称</th>
                <th>数量</th>
                <th>单价</th>
                <th>小计</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="newgoods:${carts}">
                <td>
                    <input type="hidden" name="goodid" th:value="${newgoods.goodid}" />
                    <input type="text" name="id" th:value="${newgoods.id}" />
                </td>
                <td th:text="${newgoods.goodsname}"></td>
                <td>
                    <input type="number" name="numaa" min="1" max="99" step="1" th:value="${newgoods.number}" oninput="if(value>99)value=99" />
                </td>
                <td th:text="${newgoods.price}"></td>
                <td><span class="subtal">8</span></td>
                <td>
                    <a th:href="@{'http://localhost:8896/goods/deleteCart?did='+${newgoods.id}}">删除</a>
                </td>
            </tr>
            <tr class="tr3">
                <td colspan="6">
                    商品一共 <span style="color:#ff3e3e;font-size: 18px">2</span> 件，
                    共计花费 <span class="pricetal" style="color:#ff3e3e;font-size: 18px">8</span> 元
                </td>
            </tr>
            </tbody>
        </table>
        <input type="submit" value="确定购买" class="btn-submit">
    </form>
</div>

</body>
</html>
